<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href='https://cdn.bootcss.com/twitter-bootstrap/3.0.1/css/bootstrap.min.css' rel='stylesheet'>
    <script type="text/javascript">
        window.onload = function () {
            var mySelect = document.getElementById("mySelect");
            var opts = mySelect.options;
            for (var i = 0; i < opts.length; i++) {
                if (opts[i].value == ${comm.brandId!'-1'}) {
                    opts[i].selected = true;
                }
            }
            var mySelect2 = document.getElementById("mySelect2");
            var opts = mySelect2.options;
            for (var i = 0; i < opts.length; i++) {
                if (opts[i].value == ${comm.commTypeId!'-1'}) {
                    opts[i].selected = true;
                }
            }
            var mySelect3 = document.getElementById("mySelect3");
            var opts = mySelect3.options;
            for (var i = 0; i < opts.length; i++) {
                if (opts[i].value == ${comm.status!'-1'}) {
                    opts[i].selected = true;
                }
            }


            var mySelect4 = document.getElementById("mySelect4");
            var opts = mySelect4.options;
            for (var i = 0; i < opts.length; i++) {
                if (opts[i].value == ${comm.cstatus!'-1'}) {
                    opts[i].selected = true;
                }
            }
            var butt = document.getElementById("butt");
            butt.onclick = function () {
                location.href = "addCh.ftl?commId="+${comm.id}+
                "&cbPrice=" +${comm.cbPrice};
            }
        }
    </script>
</head>
<body>
<h3 contenteditable="true">商品修改</h3>
<form action="/shangpin_update" method="post">
    <table>
        <tr>
            <th>
                <div class="form-group">
                    <input type="hidden" name="id" value="${comm.id!''}">
                    商品编码:<input type="text" name="commCode" value="${comm.commCode!''}" readonly>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    商品条形码:<input type="text" name="commBarCode" value="${comm.commBarCode!''}" readonly>
                </div>
            </th>
        </tr>
        <tr>
            <div class="form-group">
                <th>
                    商品名称:<input type="text" name="commName" value="${comm.commName!''}" readonly>
                </th>
            </div>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    品牌:
                    <select name="brandId" id="mySelect">
                    <#list brandList as brand>
                        <option value="${brand.bid!''}">${brand.bname!''}</option>
                    </#list>
                    </select>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    品类:
                    <select name="commTypeId" id="mySelect2">
                    <#list commTypes as type>
                        <option value="${type.typeId!''}">${type.typeName!''}</option>
                    </#list>
                    </select>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    进货价:<input type="number" name="jhPrice" value="${comm.jhPrice!''}">
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    成本价:<input type="number" name="cbPrice" value="${comm.cbPrice!''}">
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    商品容量:<input type="number" name="capacity" value="${comm.capacity!''}">
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    库存编号:
                    <select name="kunncunId">
                         <#list goodsList as go>
                             <option
                                 <#if go.gid==comm.kunncunId>
                                 selected
                                 </#if>>
                                 ${go.gid}
                             </option>
                         </#list>
                    </select>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    30天销量:<input type="number" name="salesVolume" value="${comm.salesVolume!''}">
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    商品规格:<input type="text" name="size" value="${comm.size!''}">
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    重量:<input type="number" name="weight" value="${comm.weight!''}">
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    商品体积:<input type="number" name="volume" value="${comm.volume!''}">
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    地址:<input type="text" name="address" value="${comm.address!''}">
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    包装单位:<input type="text" name="packge" value="${comm.packge!''}">
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    商品描述 :<input type="text" name="des" value="${comm.des!''}">
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    商品状态:
                    <select name="status" id="mySelect3">
                        <option value="1">已上架</option>
                        <option value="0">未上架</option>
                    </select>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    促销状态:
                    <select name="cstatus" id="mySelect4">
                        <option value="1">促销</option>
                        <option value="0">非促销</option>
                    </select>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    <input type="submit" value="修改">
                </div>
            </th>
        </tr>
    </table>
</form>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <dl>
                <dt>
                    容量
                </dt>
                <dd>
                ${comm.capacity}
                </dd>
                <dt>
                    规格
                </dt>
                <dd>
                ${comm.size}
                </dd>
                <dt>
                    重量
                </dt>
                <dd>
                ${comm.weight}
                </dd>
                <dt>
                    体积
                </dt>
                <dd>
                ${comm.volume}
                </dd>
                <dt>
                    产地
                </dt>
                <dd>
                ${comm.address}
                </dd>
                <dt>
                    包装单位
                </dt>
                <dd>
                ${comm.packge}
                </dd>
            </dl>
        </div>
    </div>
</div>
<h3 contenteditable="true">销售渠道</h3>
<div class="form-group">
    <input type="button" value="新增渠道" id="butt">
</div>
<from>
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="span12">
                <table class="table">
                    <thead>
                    <tr>
                        <th>
                            渠道
                        </th>
                        <th>
                            售价
                        </th>
                        <th>
                            成交价
                        </th>
                        <th>
                            操作
                        </th>
                    </tr>
                    </thead>
                    <tbody>
                        <#list comm.middleList as mid>
                        <tr>
                            <td>
                                <#list comm.channelList as ch>
                                <#if ch.channelId==mid.chid>
                                    ${ch.cname!''}
                                </#if>
                                </#list>
                            </td>
                            <td>
                                售价:${mid.price}
                            </td>
                            <td>
                                成交价格:${mid.cjPrice}
                            </td>
                            <td>
                                <a href="/deleteCh?chid=${mid.chid}&commId=${comm.id}">删除</a>
                            </td>
                        </tr>
                        </#list>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    </table>
</from>

</body>
</html>